<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <script src="./axios.min.js"></script>
    <script src="./template-web.js"></script>
</head>

<body>
    <ul></ul>
    <script type="text/html" id="tpl">
        {{each data}}
            <li>
                <a href="{{$value.href}}">
                    <img src="https://www.itcast.cn{{$value.img}}" alt="">
                    {{$value.text}}
                </a>
            </li>
        {{/each}}
    </script>




    <script>
        axios.get("http://127.0.0.1:2000/getData").then(res => {
            console.log(res, 666676)
            var html = template('tpl', res)
            document.querySelector('ul').innerHTML=html
        })
    </script>
</body>

</html>